import React, { Component } from 'react';
import '../style/index.css'
import News from './news'
import Stu from './stu'
import My from './my'
import { HashRouter as Router, Route, Redirect, Link, Switch,NavLink } from 'react-router-dom'
class Index extends Component {
    state = {}
    render() {
        return (
            <Router>
                <div className='app'>
                    <ul className='left'>
                        <li> <NavLink to='/news' activeClassName='active'>新闻中心</NavLink>  </li>
                        <li> <NavLink to='/my'  activeClassName='active'>个人设置</NavLink> </li>
                        <li><NavLink to='/stu'  activeClassName='active'>学生列表</NavLink></li>
                    </ul>
                    <div className='right'>
                        <Switch>
                            <Route path='/news' component={News}></Route>
                            <Route path='/my' component={My}></Route>
                            <Route path='/stu' component={Stu}></Route>
                            <Redirect from='/' to='/news'></Redirect>
                        </Switch>
                    </div>
                </div>
            </Router>
        );
    }
}

export default Index;